//
//  LoginProtocol.swift
//  imprint
//
//  Created by 小柠檬🍋 on 2025/1/10.
//

import Foundation
import SwiftUI

protocol DiaryProtocol {
    //查询首页，，毫秒
    func queryHomeDiary(userId:String, startTime: Int64, endTime: Int64, keyword:String?, pageNo:Int, pageSize:Int) async throws -> [DiaryBean]

    //查询ai日记
    func queryDiaryAi(userId:String, roleId:String, keyword:String?, pageNo:Int, pageSize:Int) async throws -> [DiaryBean]
    
    //查询我的日记-统计,单位是毫秒
    func queryStatisticsDiary(userId: String, curTime: TimeInterval, endTime: TimeInterval, isPicture: Bool) async throws -> [DiaryBean]
    
    //查询最近的几篇日记更新
    func queryDiaryLately(userId:String, pageNo:Int, pageSize:Int) async throws -> [DiaryBean]
    
    //最近的更新日期, 包含Ai
    func queryDiaryUpdateAll(userId:String, pageNo:Int, pageSize:Int) async throws -> [DiaryBean]
    
    //查询tag数据
    func queryTag(userId: String, tagId: String?, pageNo:Int, pageSize:Int) async throws -> [DiaryBean]
    
    //查询未提取的日记
    func queryMemoryDiary(aiUserId: String?, userId: String,pageNo: Int,pageSize:Int) async throws-> [DiaryBean]

    //保存日记
    func saveDiary(bean: DiaryBean) async throws
    
    //删除日记
    func delDiary(bean: DiaryBean) async throws
    
    //保存图片
    func saveCloudPicture(bean: CloudPictureBean) async throws
    
    //删除图片
    func delCloudPicture(bean: CloudPictureBean) async throws
    
    //查询图片
    func queryPicture(diaryId: String,userId: String, limit: Int)  async throws -> [CloudPictureBean]
    
    func queryDiaryComment(diaryId: String, pageNo: Int, pageSize: Int)  async throws -> [DiaryCommentBean]
    
    func queryDiaryComment(diaryId: String, aiRoleId: String,pageNo: Int, pageSize: Int)  async throws -> [DiaryCommentBean]
    
    //最后一条评论
    func queryDiaryLast(diaryId: String,aiRoleId: String)  async throws -> DiaryCommentBean?

    func addDiaryComment(bean: DiaryCommentBean) async throws -> DiaryCommentBean?
    //删除评论
    func deleteDiaryComment(bean: DiaryCommentBean) async throws
    //每周来信
    func queryWeekLetter(userId: String, pageNo: Int, pageSize: Int) async throws -> [WeeklyLetterBean]
    //更新每周来信
    func updateLastWeekLetter(bean: WeeklyLetterBean) async throws -> WeeklyLetterBean
    //删除每周来信
    func deleteLastWeekLetter(bean: WeeklyLetterBean) async throws
    //来电记录
    func queryActiveCall(userId: String, pageNo: Int, pageSize: Int) async throws -> [CallHistoryBean]
    //删除来电记录
    func deleteActiveCall(bean: CallHistoryBean) async throws
    //更新来电记录
    func updateActiveCall(bean: CallHistoryBean) async throws
    //检查是否任务存在
    func existTask(timeKey: String,roleId: String?, userId: String, type: Int) async throws -> Bool
    //保存任务
    func saveTask(bean: TaskBean) async throws -> TaskBean?
    //最近任务
    func getLatelyTask(roleId:String?, userId:String, type: Int, pageSize: Int) async throws -> [TaskBean]
    //获取未执行任务，包括未来任务
    func getUnExecutedTask(roleId: String?, userId: String, type: Int?) async throws -> [TaskBean]
    //删除任务
    func deleteTask(bean: TaskBean) async throws
    //查询聊天
    func queryChat(objectId: String) async throws-> ChatBean?
    //查询聊天
    func queryChat(pageNo: Int,pageSize:Int) async throws-> [ChatBean]
    //查询聊天
    func queryChat(aiUserId: String, userId: String,pageNo: Int,pageSize:Int) async throws-> [ChatBean]
    //查询聊天
    func queryChat(aiUserId: String, userId: String, isRefresh: Bool, timestamp: Int64,pageSize:Int) async throws-> [ChatBean]
    //查询最新聊天
    func queryNewChat(aiUserId: String, userId: String) async throws-> ChatBean?
    //查询未提取的聊天功能
    func queryMemoryChat(aiUserId: String, userId: String,pageNo: Int,pageSize:Int) async throws-> [ChatBean]
    //添加聊天
    func addChat(bean: ChatBean) async throws -> ChatBean
    //保存聊天
    func saveChat(bean: ChatBean) async throws
    //保存聊天
    func saveChat(list: [ChatBean]) async throws
    //清空聊天记录
    func clearChat(aiUserId: String, userId: String) async throws
    //删除聊天记录
    func deleteChat(bean: ChatBean) async throws
    //删除聊天记录
    func deleteChatList(beans: [ChatBean]) async throws
    //表情包列表
    func getEmojiPictureList() async throws-> [EmojiPictureBean]
    //添加表情包
    func addEmojiPicture(bean: EmojiPictureBean) async throws -> EmojiPictureBean
    //保存表情包
    func saveEmojiPicture(bean: EmojiPictureBean) async throws
    //删除表情包
    func deleteEmojiPicture(bean: EmojiPictureBean) async throws
    //查询最新记忆库
    func queryNewChatMemory(aiRoleId: String, userId: String) async throws -> [AiMemoryBean]
    //查询最新记忆库
    func queryMyNewChatMemory(userId: String) async throws -> [AiMemoryBean]
    func addMemory(bean: AiMemoryBean) async throws
}
